package com.hqd.ch03.v45.web.servlet;

import com.hqd.ch03.v45.SpringImitationXml;
import com.hqd.ch03.v45.factory.ConfigurableListableBeanFactory;
import com.hqd.ch03.v45.web.context.support.ServletContextResource;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;

public abstract class FrameworkServlet extends HttpServletBean {
    @Override
    protected final void initServletBean() throws ServletException {
        ServletConfig servletConfig = getServletConfig();
        String path = servletConfig.getInitParameter("contextConfigLocation");
        ServletContextResource scr = new ServletContextResource(this.getServletContext(), path);
        initStrategies(new SpringImitationXml(scr));
    }

    protected void initStrategies(ConfigurableListableBeanFactory beanFactory) {
    }
}
